IDataFrame Interface

This interface represents an in-memory, tabular data structure composed of named columns and row values.

For information about DataFrame Methods, including NameSpaces, basic functions, and examples, see DataFrame Methods.

Properties and Indexer

Property Type Description
ColumnsCount int Number of columns.
Name string? Optional name/identifier for the DataFrame.
RowCount int Number of rows in the frame. This should be preferred to .Rows.Count, since the latter will force looping through all rows, affecting performance.
Columns IEnumerable<IDataFrameColumn> Enumerable of column descriptors/objects in column ordinal order (zero-based count).
Rows IEnumerable<object[]> Enumerable of rows; each row is represented as an array of objects in column order (zero-based count).
this[int columnIndex] object Returns a representative value for the given column index.

Methods

Property Type Description
AddColumn(IDataFrameColumn dataFrameColumn) int Adds a column; returns the column ordinal of the newly added column.
AddColumn(IDataFrameColumn dataFrameColumn, bool bypassColumnShrink) int Adds a column with an option to bypass any column-capacity shrinking/resizing logic. Returns the column ordinal.
AddRow(params object[] items) void Appends a single row. items should match the number and order of Columns.
AddRowsFromColumnRowArrayAsync(object[][] items) Task Asynchronously appends multiple rows from a jagged array. Expected shape is a 2D array, where outer (first) keys specify columns and inner (second) keys specify rows.
Append(IDataFrame dataFrame) void Appends all rows/columns from another IDataFrame into this one.
GetAllColumnsNames() string[] Returns an array of all column names in ordinal order.
GetColumn(int columnOrdinal) IDataFrameColumn Returns the IDataFrameColumn at the specified zero-based ordinal.
GetColumnOrdinal(string name) int Returns the zero-based ordinal of the column with the specified name.
GetRowArray(int rowIndex) object[] Returns the row at rowIndex as an object[] in column order.
GetValue<T>(int columnOrdinal, int rowIndex) T Returns the value at the specified column and row, cast to T. May throw an invalid cast exception if the stored value cannot be converted to T.
GetValueAsObject(int columnOrdinal, int rowIndex) object Returns the value as object.
Optimize() void Triggers optimizations (e.g., compacting storage, trimming buffers, compressing sparse data). Use to reduce memory footprint or improve subsequent read performance. Use after creating the object manually.
Peek(int maxRecords = 1000) string Produces a human-readable preview (string) of up to maxRecords rows. Useful for debugging/logging.
GetParquetStreamAsync() Task<MemoryStream> Serializes the frame to Parquet format and returns a MemoryStream containing the content.
GetParquetByteArrayAsync() Task<byte[]?> Serializes to Parquet and returns the bytes, or null if serialization is not possible or fails.
ToDataSet() DataSet Converts the frame to a DataSet.
ToDataTable() DataTable Converts to a single DataTable.
ToRowsArray() object[][] Returns all rows as a 2D jagged array (object[][]) — each inner array is a row.
Split(int maxRowsPerDataFrame) IDataFrame[] Splits the frame into multiple IDataFrame segments, each with up to maxRowsPerDataFrame rows. Useful for batching/parallel processing.
ToXFDataTable(this IDataFrame dataFrame, string tableName = null) XFDataTable Converts a DataFrame to an XFDataTable using default options. Table name defaults to "DataFrame" if not provided.
ToXFDataTable(this DataFrame dataFrame, Dictionary<string,string> columnMappings, string tableName = null) XFDataTable Converts a DataFrame with explicit column name mapping. columnMappings must be a map of source column-name -> XF column-name. If a source name is not present, the original name is used. Value types default to String if not specified.
ToXFDataTable(this DataFrame dataFrame, DataFrameConversionOptions options) XFDataTable Converts a DataFrame controlling conversion to exclude columns, rename columns, override column data types, mark primary/read-only columns, limit rows, set start-row, and apply per-column value transformations. If options is null, a default DataFrameConversionOptions is created and TableName defaults to the DataFrame name or "DataFrame".

DataFrameConversionOptions

This class is a wrapper to specify options for converting DataFrames.

Property Type Description
TableName string Custom table name (default string.Empty; conversion will choose the DataFrame name or "DataFrame" if left empty).
MaxRows int Maximum amounts of rows to convert. Defaults to 0, which means "all rows".
StartRow int Convert rows starting from the rows at the specified position. Defaults to 0.
ExcludeColumns HashSet<string> Columns to exclude.
ColumnNameMappings Dictionary<string,string> Rename column names from source keys to values.
DataTypeMappings Dictionary<string,XFDataType> Override XF data types in converted output.
PrimaryKeyColumns HashSet<string> Columns flagged as primary keys.
ReadOnlyColumns HashSet<string> Columns flagged read-only.
ValueTransformations Dictionary<string, Func<T, TResult>> Per-column transform functions. The passed function will receive a value of type T and output a value of type TResult for each element in the column specified as key.

IDataFrameColumn

This interface represents a single named column in an in-memory DataFrame. It is typically accessed through the collection.

Columns found on IDataFrame instances.

Property Type Description
Name string Column name (used as the key when converting to other tabular formats).
Type Type CLR type representing the stored values (nullable wrappers are usually unwrapped by callers).
Length int Number of values in the column (may be less than the parent frame's RowCount for sparse or streaming implementations).
GetValueAsObject(int rowIndex) object Returns the raw object stored at the specified zero-based row index, or null if missing/invalid.